<!-- 详情页的导航栏 -->
<template>
  <div>
       <img src="~assets/img/back.svg" @click="back"/>
       <span v-for="(item,index) in array" :key="index" @click="pinkclick(index)" :class="{active:pinkindex==index}">{{item}}</span>
       <a></a>
  </div>
</template>

<script>
export default {
  data () {
    return {
        array:["商品","参数","评论","推荐"],
        pinkindex:0
    };
  },
  methods: {
    pinkclick(index){
         this.pinkindex=index
         this.$emit("scroll",this.pinkindex)
    },
    back(){
          this.$router.go(-1)
    }
  }
}

</script>
<style scoped>
div{
     display: flex;
     text-align: center;
     line-height: 44px;
}
img{
     width: 25px;  
}
span{
     flex: 1;
}
a{
    width: 45px;
}
.active{
     color: red;
}
</style>